home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 953 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.7 KB  |  81 lines

  1. Path: news.sunquest.com!news
  2. From: Dean Schulze <schulze@vega.lpl.arizona.edu>
  3. Newsgroups: comp.lang.c++,comp.lang.fortran
  4. Subject: Re: Calling Fortran in C++
  5. Date: 8 Jan 1996 17:05:31 GMT
  6. Organization: Sunquest Information Systems, Inc.
  7. Message-ID: <4crisr$v3u@odin.sunquest.com>
  8. References: <4cr87l$794$1@mhafc.production.compuserve.com>
  9. NNTP-Posting-Host: dwspc.sunquest.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.2 (Windows; U; 32bit)
  14.  
  15.  
  16.     Steve Harris <100016.2166@CompuServe.COM> wrote:
  17.  
  18. > Can anyone  provide me with a 'simple' example, with source
  19. > code and an 'idiots' step guide, on how to call some FORTRAN
  20. > code from MS VISUAL C++.
  21. > ..
  22. > The more I look at the examples in the book the darker the
  23. > world appears to become! 
  24.  
  25.     I recently began moving my C++/C/F77 code from
  26. SunOS to Windows NT using VC++4.0/PowerStation4.0.  Before
  27. doing this I considered using gcc/g77 and chose the
  28. Microsoft compilers after being assured by MS that mixed
  29. language programming would work with their compilers.
  30. After working with their compilers and reading their
  31. documentation I now see that their claims to support
  32. legacy code with mixed language programming are deceitful.
  33.  
  34.     In order to mix Fortran and C/C++ with Microsoft
  35. compilers you must wrap your Fortran subroutine/function
  36. definitions in Microsoft specific extensions.  This means
  37. a lot of recoding, adding non-standard code to my standard
  38. code.  What makes this even worse is that Powerstation
  39. Fortran apparently will not invoke the C Preprocessor
  40. so I cannot do something like
  41.  
  42. #ifdef MSFORTRAN
  43.  
  44.     (Microsoft abortions here)
  45.  
  46. #endif
  47.  
  48. so that I can move the code to a non-Microsoft Fortran 
  49. compiler.
  50.  
  51.     Because of this stupidity by Microsoft I STRONGLY
  52. RECOMMEND AGAINST DOING MIXED LANGUAGE PROGRAMMMING
  53. WITH MICROSOFT COMPILERS.  You can get it to work if you
  54. write enough MS specific code, but there is no good reason
  55. to do this.  Consider using gcc/g77 instead under WinNT/95
  56. or switching to Linux.
  57.  
  58.     Mixed language programming is inherently non-portable,
  59. but it is not hard to do and there is no good reason for
  60. the stupidity that Microsoft has introduced.
  61.  
  62.     Microsoft might end up making a Linux user out of
  63. me yet.
  64.  
  65. Dean Schulze
  66.  
  67.  
  68. P.S.  I have written a tutorial introduction to mixed
  69. language programming (C++/C/Fortran), including example
  70. code, which I'll be glad to send to anyone who wants it.
  71. Just e-mail me.
  72.  
  73.     My examples are work with Sun and SGI compilers,
  74. and will probably work without modifications for
  75. gcc/g77 on Win32.  My examples show how easy and clean
  76. mixed language programming is.  No Microsoft-like abortions
  77. are needed, and they should be avoided.
  78.  
  79.  
  80.  
  81.